﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mapper.Core.Config
{

    /// <summary>
    /// 接口参数配置 Mapper 配置文件
    /// </summary>
    public class ApiConfigJoinParamMapperProfile : BaseMapperProfile
    {
        /// <summary>
        /// 接口配置 Mapper 配置文件 默认构造
        /// </summary>
        public ApiConfigJoinParamMapperProfile()
        {
            //映射枚举值
            //CreateMap<Model.Developer.Tool.DbConfig.Database.DatabaseTypeEnum, Dto.Core.Database.DatabaseTypeEnum>()
            //    .ConvertUsingEnumMapping(opt => opt
            //    .MapByValue());
            //接口配置 配置
            CreateMap<Entity.Core.Config.Join.ApiConfigJoinParamEntity, Dto.Core.Config.Join.ApiConfigJoinParamDto>()
                .ForMember(dest => dest.Error, opt => opt.Ignore())
                .ForMember(dest => dest.ValidationResultInfo, opt => opt.Ignore())
                .ForMember(dest => dest.DtoMode, opt => opt.MapFrom(p => p.EntityMode))
                //.ForMember(dest => dest.DatabaseType, opt => opt.MapFrom(p => EnumHelper.EnumStringToEnum<Dto.Lib.Enum.DatabaseTypeEnum>(p.DatabaseType)))
                //.ForMember(dest => dest.Port, opt => opt.MapFrom(p => ValueTypeConvertHelper.ToUIntNullable(p.Port, null)))
                .ReverseMap();
        }
    }
}
